//
//  HHistoryExamTableViewCell.m
//  NursingManages
//
//  Created by Zhen Huang on 17/9/29.
//  Copyright © 2017年 huangzhen. All rights reserved.
//

#import "HHistoryExamTableViewCell.h"

@implementation HHistoryExamTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self.contentView addSubview:self.examNameLabel];
        [self.contentView addSubview:self.startTimeLabel];
        [self.contentView addSubview:self.useTimeLabel];
        [self.contentView addSubview:self.quesCountsLabel];
        [self.contentView addSubview:self.quesResultLabel];
        
    }
    return self;
}

- (UILabel *)examNameLabel
{
    if (!_examNameLabel) {
        _examNameLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, ScreenWidth - 20, 30)];
        _examNameLabel.font = [UIFont systemFontOfSize:18];
    }
    return _examNameLabel;
}

- (UILabel *)startTimeLabel
{
    if (!_startTimeLabel) {
        _startTimeLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, self.examNameLabel.bottom + 10, ScreenWidth - 120, 30)];
        _startTimeLabel.font = [UIFont systemFontOfSize:15];
    }
    return _startTimeLabel;
}

- (UILabel *)useTimeLabel
{
    if (!_useTimeLabel) {
        _useTimeLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.startTimeLabel.right + 10, self.examNameLabel.bottom + 10, 90, 30)];
        _useTimeLabel.textAlignment = NSTextAlignmentRight;
        _useTimeLabel.adjustsFontSizeToFitWidth = YES;
        _useTimeLabel.numberOfLines = 0;
        _useTimeLabel.font = [UIFont systemFontOfSize:15];
    }
    return _useTimeLabel;
}

- (UILabel *)quesCountsLabel {
    if (!_quesCountsLabel) {
        _quesCountsLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, self.startTimeLabel.bottom + 10, ScreenWidth * 0.4, 30)];
        _quesCountsLabel.font = [UIFont systemFontOfSize:15];
        _quesCountsLabel.textColor = RGB(69, 185, 124);

    }
    return _quesCountsLabel;
}

- (UILabel *)quesResultLabel
{
    if (!_quesResultLabel) {
        _quesResultLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.quesCountsLabel.right + 10, self.startTimeLabel.bottom + 10, ScreenWidth *0.5, 30)];
        _quesResultLabel.textAlignment = NSTextAlignmentRight;
        _quesResultLabel.font = [UIFont systemFontOfSize:15];
        _quesResultLabel.textColor = [UIColor redColor];
    }
    return _quesResultLabel;
}


- (void)setTempModel:(Model_Hr_Exam_Primary *)tempModel
{
    self.examNameLabel.text = tempModel.title;

    self.startTimeLabel.text = [NSString stringWithFormat:@"开始时间:%@",tempModel.START_TIME];
    
    self.useTimeLabel.text = [NSString stringWithFormat:@"用时:%@",tempModel.USETIMES];
    
    self.quesCountsLabel.text = [NSString stringWithFormat:@"总分:%@",tempModel.RESULT];
    
    self.quesResultLabel.text = [NSString stringWithFormat:@"得分:%@",tempModel.SCORE];
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
